% This subroutine displays model moments and data moments.
%
% Used in the paper "Land Insecurity and Mobility Frictions," by Tasso
% Adamopoulos, Loren Brandt, Chaoran Chen, Diego Restuccia, and Xiaoyun
% Wei, prepared for publication at the Quarterly Journal of Economics.
%
% Last modified: March 3, 2024

if case_id == 1 || case_id == 3 || case_id == 8 || case_id == 9 || case_id == 10 ...
        || case_id == 11
    %  1--baseline calibration;
    %  3--no eta
    %  8--no xi
    %  9--no correlation between abilities
    % 10--high correlation between abilities
    % 11--PIGL preferences

    load matfiles/datafile-2004-nationwide.mat
    fprintf('-------------------------------------------------- \n');
    fprintf('                                Data   Model \n');
    fprintf('Occupational Choice of Rural Individuals: \n');
    fprintf('  Full-time  Nonagr Worker:     %+5.3f  %+5.3f     \n', ...
        data_rural_nonagr_emp+data_urban_nonagr_emp, ...
        sum(sum(dummy_rural+dummy_urban))/P.N_sim/P.N_ind);
    fprintf('  Part-time Worker:      \n');
    fprintf('    PT Worker:                  %+5.3f  %+5.3f    \n', ...
        data_parttime_rural_emp+data_parttime_urban_emp, ...
        sum(sum(dummy_pt_r+dummy_pt_u))/P.N_sim/P.N_ind);
    fprintf('    Median Hours Agr Among PT:  %+5.3f  %+5.3f    \n', ...
        data_ave_hour_pt, ave_hour_pt);
    fprintf('    Corr Hour Inc Among PT:     %+5.3f  %+5.3f    \n', ...
        data_corr_inc_ls_pt, corr_inc_ls_pt);
    fprintf('Family with Operators:          %+5.3f  %+5.3f    \n', ...
        data_PCT_family_operator, PCT_family_operator);
    fprintf('Income Moments: \n');
    fprintf('  Dispersion:   \n');
    fprintf('    FT Nonagr:                  %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr, std_inc_nonagr);
    fprintf('      Within HH Corr:           %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr_across, std_inc_nonagr_across);
    fprintf('  Corr farming nonagr:          %+5.3f  %+5.3f    \n', ...
        data_corr_pi_nonagr,corr_pi_nonagr);
    fprintf('Sectoral Wage Differentials: \n');
    fprintf('    Nonagr - Operator:          %+5.3f  %+5.3f    \n', ...
        data_inc_diff_uo, inc_diff_uo);
    fprintf('Family Wage Differentials: \n');
    fprintf('    With/Without Operator:      %+5.3f  %+5.3f    \n', ...
        data_inc_diff_nonagr_migration, inc_diff_nonagr_migration);
    fprintf('Agr Production Moments:   \n');
    fprintf('  Dispersion:   \n');
    fprintf('    Farm TFP:                   %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPQ,std_farm_TFPQ);
    fprintf('    Farm TFPR:                  %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPR,std_farm_TFPR);
    fprintf('  Correlation:   \n');
    fprintf('    TFP VS TFPR:                %+5.3f  %+5.3f    \n', ...
        data_corr_farm_TFPQ_TFPR,corr_farm_TFPQ_TFPR);
    fprintf('GLW Gap:                        %+5.3f  %+5.3f    \n', ...
        data_GLW_inv,agr_VA_share/agr_emp_share);
    fprintf('-------------------------------------------------- \n');
elseif case_id == 2 % 2018 calibration

    load matfiles/datafile-2018-nationwide.mat
    fprintf('-------------------------------------------------- \n');
    fprintf('                                Data   Model \n');
    fprintf('Occupational Choice of Rural Individuals: \n');
    fprintf('  Full-time  Nonagr Worker:     %+5.3f  %+5.3f     \n', ....
        data_rural_nonagr_emp+data_urban_nonagr_emp, sum(sum(dummy_rural+dummy_urban))/P.N_sim/P.N_ind);
    fprintf('  Part-time Worker:      \n');
    fprintf('    PT Worker:                  %+5.3f  %+5.3f    \n', ...
        data_parttime_rural_emp+data_parttime_urban_emp, sum(sum(dummy_pt_r+dummy_pt_u))/P.N_sim/P.N_ind);
    fprintf('    Median Hours Agr Among PT:  %+5.3f  %+5.3f    \n', ...
        data_ave_hour_pt, ave_hour_pt);
    fprintf('    Corr Hour Inc Among PT:     %+5.3f  %+5.3f    \n', ...
        data_corr_inc_ls_pt, corr_inc_ls_pt);
    fprintf('Family with Operators:          %+5.3f  %+5.3f    \n', ...
        data_PCT_family_operator, PCT_family_operator);
    fprintf('Income Moments: \n');
    fprintf('  Dispersion:   \n');
    fprintf('    FT Nonagr:                  %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr, std_inc_nonagr);
    fprintf('      Within HH Corr:           %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr_across, std_inc_nonagr_across);
    fprintf('  Corr farming nonagr:          %+5.3f  %+5.3f    \n', ...
        data_corr_pi_nonagr,corr_pi_nonagr);
    fprintf('Sectoral Wage Differentials: \n');
    fprintf('    Nonagr - Operator:          %+5.3f  %+5.3f    \n', ...
        data_inc_diff_uo, inc_diff_uo);
    fprintf('Family Wage Differentials: \n');
    fprintf('    With/Without Operator:      %+5.3f  %+5.3f    \n', ...
        data_inc_diff_nonagr_migration, inc_diff_nonagr_migration);
    fprintf('Agr Production Moments:   \n');
    fprintf('  Dispersion:   \n');
    fprintf('    Farm TFP:                   %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPQ,std_farm_TFPQ);
    fprintf('    Farm TFPR:                  %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPR,std_farm_TFPR);
    fprintf('  Correlation:   \n');
    fprintf('    TFP VS TFPR:                %+5.3f  %+5.3f    \n', ...
        data_corr_farm_TFPQ_TFPR,corr_farm_TFPQ_TFPR);
    fprintf('  GLW Gap:                      %+5.3f  %+5.3f    \n', ...
        data_GLW_inv,agr_VA_share/agr_emp_share);
    fprintf('-------------------------------------------------- \n');
elseif case_id == 4 % 2 nonagr sectors

    load matfiles/datafile-2004-nationwide.mat
    fprintf('-------------------------------------------------- \n');
    fprintf('                                Data   Model \n');
    fprintf('Occupational Choice of Rural Individuals: \n');
    fprintf('  Full-time Worker:   \n');
    fprintf('    Rural Nonagr Worker:        %+5.3f  %+5.3f     \n', ...
        data_rural_nonagr_emp, sum(sum(dummy_rural))/P.N_sim/P.N_ind);
    fprintf('    Urban Nonagr Worker:        %+5.3f  %+5.3f     \n', ...
        data_urban_nonagr_emp, sum(sum(dummy_urban))/P.N_sim/P.N_ind);
    fprintf('  Part-time Worker:      \n');
    fprintf('    Rural:                      %+5.3f  %+5.3f    \n', ...
        data_parttime_rural_emp, sum(sum(dummy_pt_r))/P.N_sim/P.N_ind);
    fprintf('    Urban:                      %+5.3f  %+5.3f    \n', ...
        data_parttime_urban_emp, sum(sum(dummy_pt_u))/P.N_sim/P.N_ind);
    fprintf('    Median Hours Agr Among PT:  %+5.3f  %+5.3f    \n', ...
        data_ave_hour_pt, ave_hour_pt);
    fprintf('    Corr Hour Inc Among PT:     %+5.3f  %+5.3f    \n', ...
        data_corr_inc_ls_pt, corr_inc_ls_pt);
    fprintf('Family with Operators:          %+5.3f  %+5.3f    \n', ...
        data_PCT_family_operator, PCT_family_operator);
    fprintf('Income Moments: \n');
    fprintf('  Dispersion:   \n');
    fprintf('    FT Nonagr:                  %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr, std_inc_nonagr);
    fprintf('      Within HH Corr:           %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr_across, std_inc_nonagr_across);
    fprintf('  Corr farming nonagr:          %+5.3f  %+5.3f    \n', ...
        data_corr_pi_nonagr,corr_pi_nonagr);
    fprintf('Sectoral Wage Differentials: \n');
    fprintf('    Urban - Rural:              %+5.3f  %+5.3f    \n', ...
        data_inc_diff_ur_2nonagr, inc_diff_ur);
    fprintf('    Urban - Operator:           %+5.3f  %+5.3f    \n', ...
        data_inc_diff_uo_2nonagr, inc_diff_uo);
    fprintf('Family Wage Differentials: \n');
    fprintf('    With/Without Operator:      %+5.3f  %+5.3f    \n', ...
        data_inc_diff_nonagr_migration, inc_diff_nonagr_migration);
    fprintf('Agr Production Moments:   \n');
    fprintf('  Dispersion:   \n');
    fprintf('    Farm TFP:                   %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPQ,std_farm_TFPQ);
    fprintf('    Farm TFPR:                  %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPR,std_farm_TFPR);
    fprintf('  Correlation:   \n');
    fprintf('    TFP VS TFPR:                %+5.3f  %+5.3f    \n', ...
        data_corr_farm_TFPQ_TFPR,corr_farm_TFPQ_TFPR);
    fprintf('GLW Gap:                        %+5.3f  %+5.3f    \n', ...
        data_GLW_inv,agr_VA_share/agr_emp_share);
    fprintf('-------------------------------------------------- \n');
elseif case_id == 5 % 2 nonagr and age

    load matfiles/datafile-2004-nationwide.mat
    fprintf('-------------------------------------------------- \n');
    fprintf('                                Data   Model \n');
    fprintf('Occupational Choice of Rural Individuals: \n');
    fprintf('  Full-time Worker:   \n');
    fprintf('    Rural Nonagr Worker:        %+5.3f  %+5.3f     \n', ...
        data_rural_nonagr_emp, sum(sum(dummy_rural))/P.N_sim/P.N_ind);
    fprintf('    Urban Nonagr Worker:        %+5.3f  %+5.3f     \n', ...
        data_urban_nonagr_emp, sum(sum(dummy_urban))/P.N_sim/P.N_ind);
    fprintf('  Part-time Worker:      \n');
    fprintf('    Rural:                      %+5.3f  %+5.3f    \n', ...
        data_parttime_rural_emp, sum(sum(dummy_pt_r))/P.N_sim/P.N_ind);
    fprintf('    Urban:                      %+5.3f  %+5.3f    \n', ...
        data_parttime_urban_emp, sum(sum(dummy_pt_u))/P.N_sim/P.N_ind);
    fprintf('    Median Hours Agr Among PT:  %+5.3f  %+5.3f    \n', ...
        data_ave_hour_pt, ave_hour_pt);
    fprintf('    Corr Hour Inc Among PT:     %+5.3f  %+5.3f    \n', ...
        data_corr_inc_ls_pt, corr_inc_ls_pt);
    fprintf('Age Distribution (PCT of Old Individuals): \n');
    fprintf('  Operator + FT Agr:            %+5.3f  %+5.3f     \n', ...
        data_PCT_old_farming, sum(sum((dummy_ope+dummy_agr).*dummy_old))/sum(sum(dummy_ope+dummy_agr)));
    fprintf('  Rural Nonagr:                 %+5.3f  %+5.3f     \n', ...
        data_PCT_old_rural, sum(sum((dummy_rural+dummy_pt_r).*dummy_old))/sum(sum(dummy_rural+dummy_pt_r)));
    fprintf('Family with Operators:          %+5.3f  %+5.3f    \n', ...
        data_PCT_family_operator, PCT_family_operator);
    fprintf('Income Moments: \n');
    fprintf('  Dispersion:   \n');
    fprintf('    FT Nonagr:                  %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr, std_inc_nonagr);
    fprintf('      Within HH Corr:           %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr_across, std_inc_nonagr_across);
    fprintf('  Corr farming nonagr:          %+5.3f  %+5.3f    \n', ...
        data_corr_pi_nonagr, corr_pi_nonagr);
    fprintf('Sectoral Wage Differentials: \n');
    fprintf('    Urban - Rural:              %+5.3f  %+5.3f    \n', ...
        data_inc_diff_ur_2nonagr, inc_diff_ur);
    fprintf('    Urban - Operator:           %+5.3f  %+5.3f    \n', ...
        data_inc_diff_uo_2nonagr, inc_diff_uo);
    fprintf('Family Wage Differentials: \n');
    fprintf('    With/Without Operator:      %+5.3f  %+5.3f    \n', ...
        data_inc_diff_nonagr_migration, inc_diff_nonagr_migration);
    fprintf('Young-Old Wage Differentials: \n');
    fprintf('    Rural Non-agr:              %+5.3f  %+5.3f    \n', ...
        data_inc_diff_yo_r, inc_diff_yo_r);
    fprintf('    Operator:                   %+5.3f  %+5.3f    \n', ...
        data_inc_diff_yo_ope, inc_diff_yo_ope);
    fprintf('Agr Production Moments:   \n');
    fprintf('  Dispersion:   \n');
    fprintf('    Farm TFP:                   %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPQ,std_farm_TFPQ);
    fprintf('    Farm TFPR:                  %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPR,std_farm_TFPR);
    fprintf('  Correlation:   \n');
    fprintf('    TFP VS TFPR:                %+5.3f  %+5.3f    \n', ...
        data_corr_farm_TFPQ_TFPR,corr_farm_TFPQ_TFPR);
    fprintf('GLW Gap:                        %+5.3f  %+5.3f    \n', ...
        data_GLW_inv,agr_VA_share/agr_emp_share);
    fprintf('-------------------------------------------------- \n');
elseif case_id == 6 % remote

    load matfiles/datafile-2004-remote.mat
    fprintf('-------------------------------------------------- \n');
    fprintf('                                Data   Model \n');
    fprintf('Occupational Choice of Rural Individuals: \n');
    fprintf('  Full-time Worker:   \n');
    fprintf('    Rural Nonagr Worker:        %+5.3f  %+5.3f     \n', ...
        data_rural_nonagr_emp, sum(sum(dummy_rural))/P.N_sim/P.N_ind);
    fprintf('    Urban Nonagr Worker:        %+5.3f  %+5.3f     \n', ...
        data_urban_nonagr_emp, sum(sum(dummy_urban))/P.N_sim/P.N_ind);
    fprintf('  Part-time Worker:      \n');
    fprintf('    Rural:                      %+5.3f  %+5.3f    \n', ...
        data_parttime_rural_emp, sum(sum(dummy_pt_r))/P.N_sim/P.N_ind);
    fprintf('    Urban:                      %+5.3f  %+5.3f    \n', ...
        data_parttime_urban_emp, sum(sum(dummy_pt_u))/P.N_sim/P.N_ind);
    fprintf('    Median Hours Agr Among PT:  %+5.3f  %+5.3f    \n', ...
        data_ave_hour_pt, ave_hour_pt);
    fprintf('    Corr Hour Inc Among PT:     %+5.3f  %+5.3f    \n', ...
        data_corr_inc_ls_pt, corr_inc_ls_pt);
    fprintf('Age Distribution (PCT of Old Individuals): \n');
    fprintf('  Operator + FT Agr:            %+5.3f  %+5.3f     \n', ...
        data_PCT_old_farming, sum(sum((dummy_ope+dummy_agr).*dummy_old))/sum(sum(dummy_ope+dummy_agr)));
    fprintf('  Rural Nonagr:                 %+5.3f  %+5.3f     \n', ...
        data_PCT_old_rural, sum(sum((dummy_rural+dummy_pt_r).*dummy_old))/sum(sum(dummy_rural+dummy_pt_r)));
    fprintf('Family with Operators:          %+5.3f  %+5.3f    \n', ...
        data_PCT_family_operator, PCT_family_operator);
    fprintf('Income Moments: \n');
    fprintf('  Dispersion:   \n');
    fprintf('    FT Nonagr:                  %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr, std_inc_nonagr);
    fprintf('      Within HH Corr:           %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr_across, std_inc_nonagr_across);
    fprintf('  Corr farming nonagr:          %+5.3f  %+5.3f    \n', ...
        data_corr_pi_nonagr, corr_pi_nonagr);
    fprintf('Sectoral Wage Differentials: \n');
    fprintf('    Urban - Rural:              %+5.3f  %+5.3f    \n', ...
        data_inc_diff_ur_2nonagr, inc_diff_ur);
    fprintf('    Urban - Operator:           %+5.3f  %+5.3f    \n', ...
        data_inc_diff_uo_2nonagr, inc_diff_uo);
    fprintf('Family Wage Differentials: \n');
    fprintf('    With/Without Operator:      %+5.3f  %+5.3f    \n', ...
        data_inc_diff_nonagr_migration, inc_diff_nonagr_migration);
    fprintf('Young-Old Wage Differentials: \n');
    fprintf('    Rural Non-agr:              %+5.3f  %+5.3f    \n', ...
        data_inc_diff_yo_r, inc_diff_yo_r);
    fprintf('    Operator:                   %+5.3f  %+5.3f    \n', ...
        data_inc_diff_yo_ope, inc_diff_yo_ope);
    fprintf('Agr Production Moments:   \n');
    fprintf('  Dispersion:   \n');
    fprintf('    Farm TFP:                   %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPQ,std_farm_TFPQ);
    fprintf('    Farm TFPR:                  %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPR,std_farm_TFPR);
    fprintf('  Correlation:   \n');
    fprintf('    TFP VS TFPR:                %+5.3f  %+5.3f    \n', ...
        data_corr_farm_TFPQ_TFPR,corr_farm_TFPQ_TFPR);
    fprintf('GLW Gap:                        %+5.3f  %+5.3f    \n', ...
        data_GLW_inv,agr_VA_share/agr_emp_share);
    fprintf('-------------------------------------------------- \n');
elseif case_id == 7 % peri-urban

    load matfiles/datafile-2004-periurban.mat
    fprintf('-------------------------------------------------- \n');
    fprintf('                                Data   Model \n');
    fprintf('Occupational Choice of Rural Individuals: \n');
    fprintf('  Full-time Worker:   \n');
    fprintf('    Rural Nonagr Worker:        %+5.3f  %+5.3f     \n', ...
        data_rural_nonagr_emp, sum(sum(dummy_rural))/P.N_sim/P.N_ind);
    fprintf('    Urban Nonagr Worker:        %+5.3f  %+5.3f     \n', ...
        data_urban_nonagr_emp, sum(sum(dummy_urban))/P.N_sim/P.N_ind);
    fprintf('  Part-time Worker:      \n');
    fprintf('    Rural:                      %+5.3f  %+5.3f    \n', ...
        data_parttime_rural_emp, sum(sum(dummy_pt_r))/P.N_sim/P.N_ind);
    fprintf('    Urban:                      %+5.3f  %+5.3f    \n', ...
        data_parttime_urban_emp, sum(sum(dummy_pt_u))/P.N_sim/P.N_ind);
    fprintf('    Median Hours Agr Among PT:  %+5.3f  %+5.3f    \n', ...
        data_ave_hour_pt, ave_hour_pt);
    fprintf('    Corr Hour Inc Among PT:     %+5.3f  %+5.3f    \n', ...
        data_corr_inc_ls_pt, corr_inc_ls_pt);
    fprintf('Age Distribution (PCT of Old Individuals): \n');
    fprintf('  Operator + FT Agr:            %+5.3f  %+5.3f     \n', ...
        data_PCT_old_farming, sum(sum((dummy_ope+dummy_agr).*dummy_old))/sum(sum(dummy_ope+dummy_agr)));
    fprintf('  Rural Nonagr:                 %+5.3f  %+5.3f     \n', ...
        data_PCT_old_rural, sum(sum((dummy_rural+dummy_pt_r).*dummy_old))/sum(sum(dummy_rural+dummy_pt_r)));
    fprintf('Family with Operators:          %+5.3f  %+5.3f    \n', ...
        data_PCT_family_operator, PCT_family_operator);
    fprintf('Income Moments: \n');
    fprintf('  Dispersion:   \n');
    fprintf('    FT Nonagr:                  %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr, std_inc_nonagr);
    fprintf('      Within HH Corr:           %+5.3f  %+5.3f    \n', ...
        data_std_inc_nonagr_across, std_inc_nonagr_across);
    fprintf('  Corr farming nonagr:          %+5.3f  %+5.3f    \n', ...
        data_corr_pi_nonagr, corr_pi_nonagr);
    fprintf('Sectoral Wage Differentials: \n');
    fprintf('    Urban - Rural:              %+5.3f  %+5.3f    \n', ...
        data_inc_diff_ur_2nonagr, inc_diff_ur);
    fprintf('    Urban - Operator:           %+5.3f  %+5.3f    \n', ...
        data_inc_diff_uo_2nonagr, inc_diff_uo);
    fprintf('Family Wage Differentials: \n');
    fprintf('    With/Without Operator:      %+5.3f  %+5.3f    \n', ...
        data_inc_diff_nonagr_migration, inc_diff_nonagr_migration);
    fprintf('Young-Old Wage Differentials: \n');
    fprintf('    Rural Non-agr:              %+5.3f  %+5.3f    \n', ...
        data_inc_diff_yo_r, inc_diff_yo_r);
    fprintf('    Operator:                   %+5.3f  %+5.3f    \n', ...
        data_inc_diff_yo_ope, inc_diff_yo_ope);
    fprintf('Agr Production Moments:   \n');
    fprintf('  Dispersion:   \n');
    fprintf('    Farm TFP:                   %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPQ,std_farm_TFPQ);
    fprintf('    Farm TFPR:                  %+5.3f  %+5.3f    \n', ...
        data_std_farm_TFPR,std_farm_TFPR);
    fprintf('  Correlation:   \n');
    fprintf('    TFP VS TFPR:                %+5.3f  %+5.3f    \n', ...
        data_corr_farm_TFPQ_TFPR,corr_farm_TFPQ_TFPR);
    fprintf('GLW Gap:                        %+5.3f  %+5.3f    \n', ...
        data_GLW_inv,agr_VA_share/agr_emp_share);
    fprintf('-------------------------------------------------- \n');
end
